1. modularize /goal logic - #2184
Conversation
Prime Agent performance — completedPR Overall: 0 regressed · 0 improved · 17 no clear change.
Python runtime
Sandbox cost: ~$0.0909 — no inference calls. Methodology and samplesMain resolved at 2026-09-13T05:39:25.501078+00:00. Harness
|
Refs: ENG-5938 fixes #2184
caee21d to
120516e
Compare
Refs: ENG-5938
Refs: ENG-5938 fixes #2184
120516e to
c6135c1
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit c6135c1. Configure here.

npm run checkpass.Note
Medium Risk
Refactors goal accounting and persistence paths that affect continuations and budget limits; behavior is intended to be unchanged but ordering invariants must stay correct.
Overview
Extracts goal lifecycle, persistence, and
/goalparsing out ofAgentSessioninto a dedicatedgoals/feature folder, as the first step in modularizing session execution code.GoalControllernow owns transitions (start/clear/pause/resume/complete/fail), token and wall-clock accounting, continuation increments/rollbacks, assistant usage deduplication, and checkpoint/restore for admission races.createGoalPersistencehandles branch load/save, immediate flush, and CLI--goalseed eligibility.parseGoalSlashCommandholds slash parsing and budget validation.AgentSessionkeeps cross-cutting work—queueing goal context messages, continuations after RLM quiescence, host APIs—and delegates mutations through the controller; shared types stay incore/goals.ts.Adds
src/README.mddocumenting ownership boundaries and ordering invariants (usage before tools, completion clears stale budget context, continuation rollback restores clock). Newtest/goals/controller.test.tsand harness updates ingoal-continuation-quiescence.test.tsexercise the extracted API.Reviewed by Cursor Bugbot for commit 7de5766. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Modularize
/goallogic intoGoalControllerandgoals/commands.tsAgentSessionintogoals/controller.tsandgoals/persistence.ts.goals/commands.ts.AgentSessionto delegate goal operations toGoalControllerinstead of using local goal fields.goal-continuation-quiescence.test.tsto use the new controller, and addscontroller.test.tsfor deterministic lifecycle and accounting tests.AgentSession.goalStatenow returnsGoalControllerstate instead of locally computed wall-clock state; branch reloads now reload the controller from persistence.Macroscope summarized 7de5766.